<% provide(:title, @document.name) %>

<div class="doc_header">
  <div id="doc_content_title"><%= @document.name %></div>
  
	<% if show_admin_options?('Documents', @document.id) %>
	<div class='admin_options'>
		<% if has_permission_for?('Documents', 'edit', @document.id) %>
			<%= link_to 'Edit', edit_document_path(@document), action: :edit, class: "button", id: "edit_button" %>
		<% end %>
		<% if has_permission_for?('Documents', 'destroy', @document.id) %>
			<%= button_to 'Delete', @document, method: :delete, confirm: 'Are you sure?', class: "button", id: "delete_button" %>
		<% end %>
	</div>
	<% end %>
  
</div>
<hr noshade size="1">


<div id="tabs">
    <ul class="tab">
        <li><a href="#file">
            <span class="detail_navigation_label"><%= t('activerecord.attributes.document.file') %></span>
            </a></li>
        <li><a href="#metadata">
            <span class="detail_navigation_label"><%= t('activerecord.attributes.document.metadata') %></span>
            </a></li>
        <li><a href="#comments">
              <span class="detail_navigation_label"><%= t('activerecord.attributes.document.comments') %></span>
            </a></li>
        <li><a href="#related_work">
             <span class="detail_navigation_label"><%= t('activerecord.attributes.document.related_work') %></span>
            </a></li>
    </ul>
  
    <div id="file" class="tab_content">
        <p>
           <%= image_tag("document/Platzhalter.JPG", :alt => "Vorschau Platzhalter", class: "platzhalter_foto") %>
		
        </p>
                
        <p>
          <%= link_to 'Download', "/#{@document.file.path}", class: "button", id: "download_button" %><br/>
        </p>
    </div>
    <div id="metadata" class="tab_content">
        <div class="detail_metadata_box">
          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.authors') %>:</span>
          <span class="detail_metadata_output_bold"><%= @document.authors %></span><br><br>

          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.publication_date') %>:</span>
          <span class="detail_metadata_output"><%= l(@document.publication_date) unless @document.publication_date.blank? %></span><br><br> 

          <span class="detail_metadata_label"><%= t('activerecord.attributes.created_at') %>:</span>
          <span class="detail_metadata_output"><%= l(@document.created_at, format: :short) %></span><br><br>

          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.size') %>:</span>
          <span class="detail_metadata_output"><%= number_to_human_size @document.file.file_size %></span><br><br>

          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.type') %>:</span>
          <span class="detail_metadata_output"><%= @document.file.mime_type %></span><br><br>

          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.tags') %>:</span>
          <span class="detail_tag_style"><%= @document.tags.map { |t| link_to t.name, t }.join(', ').html_safe %></span><br><br style="clear:both;">

          <span class="detail_metadata_label"><%= t('activerecord.models.category', count: 2) %>:</span>
          <span class="detail_category_style">
				<%= @document.categories.map { |category| link_to category.name, category }.join(', ').html_safe %>
		  </span><br><br style="clear:both;">

          <!--span class="detail_metadata_label"><%= t('activerecord.attributes.document.visability') %>:</span>
          <span class="detail_metadata_output">Muss noch eingebunden werden!!!!!</span><br><br-->

          <span class="detail_metadata_label"><%= t('activerecord.attributes.document.description') %>:</span>
          <span class="detail_metadata_output_description"><%= simple_format(@document.description) %></span><br><br>
        </div>
    </div>
    <div id="comments" class="tab_content">
        <%= render 'comments/new' %>
        <%= render 'comments/index', comments: @comments %>
    </div>
    <div id="related_work" class="tab_content"></div>
</div>




